package com.example.demo_videos.controller;

import com.example.demo_videos.pojo.Comment;
import com.example.demo_videos.service.CommentService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("/comments")
public class CMTController {

    @Resource
    private CommentService commentService;

    @RequestMapping("/insertDoc")
    @ResponseBody
    public String insertDoc(Comment comment){
        int result = commentService.insertDoc(comment);
        return String.valueOf(result);
    }

    @RequestMapping("/selectDoc")
    @ResponseBody
    public List selectDoc(){
       return commentService.selectDoc();
    }
}
